package org.dtrd.modules.evaluation.entity.bean;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.modules.evaluation.entity.po.DtrdEntEvaluationRdCdmses;

import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 * 自我管理效能（C-DMSES）
 * </p>
 *
 * @author QR
 * @since 2021-12-15
 */
@Getter
@Setter
@ApiModel(value = "自我管理效能（C-DMSES）详情")
public class CdmsesDetail {

    private Integer dataId;


    @ApiModelProperty("患者ID")
    private Integer patientId;


    @ApiModelProperty("输入内容")
    private List<Integer> input;

    @ApiModelProperty("总分")
    private Integer score;

    @ApiModelProperty("输出内容")
    private String output;

    @ApiModelProperty("创建时间")
    private Date createTime;

    public CdmsesDetail parseFromPo(DtrdEntEvaluationRdCdmses po) {
        dataId = po.getDataId();
        patientId = po.getPatientId();
        String inputStr = po.getInput();
        String[] split = inputStr.split(",");
        input = Arrays.stream(split).map(Integer::parseInt).collect(Collectors.toList());
        score = po.getScore();
        output = po.getOutput();
        createTime = po.getCreateTime();
        return this;
    }
}
